﻿// 2018/8/24: 首个记录
// 2019/3/29: 添加注释
// 2019/10/11: 修改pragma once和include
// 2020/1/14: 接口完整性
// 2020/11/12: 支持Spadas7
// 2022/11/2: 支持Spadas8.4
// 2023/10/10: 补充部分英文注释
// 2024/7/3: 基于新样本框架
// 2025/3/25: 实现fromSample
// 2025/3/26: 实现getProtocolNames
// 2025/8/4: 不使用cat宏
// 2025/8/4: 修正fromSample未赋值时间戳问题

#ifndef FREESPACE_SAMPLE_V1_H
#define FREESPACE_SAMPLE_V1_H

#include "spadas.h"

namespace freespace_sample_v1
{
	using namespace spadas;

	struct FreespacePointSequence
	{
		Array<Point2D> points; // [m] List of points for each sequence / 每段可行驶区域的顶点列表
	};

	struct FreespaceSampleData
	{
		Array<FreespacePointSequence> sequences; // List of point sequences (Freespace can be described in multiple sequences) / 可行驶区域列表(可多段描述)
	};

	class FreespaceSample : public Object<class FreespaceSampleVars>
	{
	public:
		SPADAS_TYPE("freespace_sample_v1.FreespaceSample")

		FreespaceSample();
		FullTimestamp& timestamp();
		FreespaceSampleData *operator ->();

		static String getProtocolName(UInt channel);
		SessionGeneralSample toGeneralSample();

		static Array<String> getProtocolNames(UInt channel);
		Bool fromGeneralSample(String protocol, SessionGeneralSample generalSample);
	};
}

#endif